package com.wu.ssm.study.threadlocal;


import org.springframework.transaction.annotation.Transactional;

/**
 * Created by wzf on 2018/11/18/018.
 */
public class SequenceA implements Sequence {

    private static volatile int number = 0;

    @Override
    public int getNumber() {
        number = number + 1;
        return number;
    }

    @Transactional
    public static void main(String[] args) {
        SequenceA sequenceA = new SequenceA();

        ClientThread thread1 = new ClientThread(sequenceA);
        ClientThread thread2 = new ClientThread(sequenceA);
        ClientThread thread3 = new ClientThread(sequenceA);
        thread1.start();
        thread2.start();
        thread3.start();

    }
}
